﻿using System;
using Silvermoon.OpenGL;
using System.Reflection;

using System.Collections.Generic;
using System.Text;
using Silvermoon.Windows;
using Silvermoon.Controls;
using System.Drawing;
using Silvermoon.Windows.Styles;
using Silvermoon.Shapes;
using Silvermoon.Images;

namespace Testing
{
    public class ButtonsDemo : DemoWindowBase
    {

        RadioButton r1, r2, r3;

        public ButtonsDemo()
            : base()
        {
            Initialize();
        }

        protected override void Dispose(bool dispose)
        {
            base.Dispose(dispose);
        }

        protected override void OnBack(HandledEventArgs e)
        {
            base.OnBack(e);
        }

        protected override Silvermoon.Shapes.Shape CreateDefaultBackground()
        {
            return PhoneColors.Dark;
        }

        void Initialize()
        {
            // Styles = new MetroStyles();
            r1 = new RadioButton { Margin = new Margin(24, 24, 24, null), Content = "Radio 1", IsChecked = true };
            r2 = new RadioButton { Margin = new Margin(24, 104, 24, null), Content = "Radio 2" };
            r3 = new RadioButton { Margin = new Margin(24, 184, 24, null), Content = "Radio 3" };

            Button button = new Button
            {
                Bounds = new Rectangle(48, 300, 320, 80),
                Color = PhoneColors.Dark,
                // Content = new StackShape(SysImages.RecycleBin, "Recycle"),
            };
            button.Content = SysImages.RecycleBin;
            button.Content += "Recycle";
            button.Color = PhoneColors.Dark;


            ToggleButton toggle = new ToggleButton
            {
                Margin = new Margin(true, false) { Bottom = 24 },
                Size = new Size(200, 64),
                Color = PhoneColors.Dark,
                IsChecked = true,
                OnContent = "Enabled",
                OffContent = "Disabled"
            };
            toggle.CheckedChanged += new EventHandler(toggle_CheckedChanged);

            Controls.Add(r1, r2, r3, toggle, button);
        }

        void toggle_CheckedChanged(object sender, EventArgs e)
        {
            ToggleButton tb = sender as ToggleButton;
            bool enabled = tb.IsChecked;
            r1.Enabled = enabled;
            r2.Enabled = enabled;
            r3.Enabled = enabled;
        }

    }

}
